package ProjectManagement;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
@WebServlet(name = "messagelogin", value = "/ProjectManagement/messagelogin")
public class messagelogin extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        HttpSession session=request.getSession();
        request.setCharacterEncoding("UTF-8");
        String username=request.getParameter("username");
        String gender=request.getParameter("gender");
        if (username!=null&&gender!=null){
            session.setAttribute("username",username);
            session.setAttribute("gender",gender);
            response.sendRedirect("messageboard.jsp");
        }else {
            response.sendRedirect("messagelogin.jsp");
        }
    }
}
